package ar.edu.utn.xcontainer;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;



public class Instrospection {
	
	public void assignValueToField(Object object, Field field, Object value) throws Exception {
		field.set(object, value);
	}
	
	public <T> Constructor[] getClassConstructor(Class<T> classe){
		return classe.getConstructors();
	}
	
	public Field[] getClassField(Class classe){
		return classe.getFields();
	}
	
	public static Method[] getClassMethods(Class classe){
		return classe.getMethods();
	}
	
	//TODO eliminar si no se van a usar
	/*public static boolean isExistSetter(Class classe, String field){
		Method[] methods = getClassMethods(classe);
		
		Method method = containsSet(methods, field);
		
		return (method != null);
	}*/

	/*private static Method containsSet(Method[] methods, String field) {
		for (Method method : methods) {
			if (MatchWord.matchWithFieldName(method.getName(),field)){
				return method;
			}
		}
		return null;
	}*/
}
